package com.yuw.staticproxy.service.proxy;

import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;

import com.yuw.staticproxy.service.ISpokesman;
import com.yuw.staticproxy.service.impl.TransportSpokesman;

public class TransportSpokesmanProxy implements ISpokesman {

	// 代理类内部引用委托类
	private TransportSpokesman tSpeaker;

	/**
	 * 构造方法
	 * 
	 * @param eSpeaker
	 */
	public TransportSpokesmanProxy(TransportSpokesman tSpeaker) {
		this.tSpeaker = tSpeaker;
	}

	@Override
	public void doSpeaking() {
		Logger.getLogger(this.getClass().getSimpleName()).log(Level.INFO, new Date().toLocaleString() + " 新闻发布会马上开始.");
		// 代理类调用被托管类的具体业务方法，来代为管理整体流程，被托管类则需要只关注于自身业务内容即可
		tSpeaker.doSpeaking();
		Logger.getLogger(this.getClass().getSimpleName()).log(Level.INFO, new Date().toLocaleString() + " 新闻发布会结束.");

	}

}
